//
//  AddressDownViewXin.m
//  FD
//
//  Created by xiaofang wang on 2019/1/7.
//  Copyright © 2019年 ZhiYuan Network. All rights reserved.
//

#import "AddressDownViewXin.h"
#import "NewAddressLabelTextField.h"
#define kAddressLTFrame CGRectMake(0, 0, SCREEN_WIDTH, 50)

@interface AddressDownViewXin() <UITextFieldDelegate>

/**viewsArr*/
@property (nonatomic, strong) NSArray *viewArr;

@end

@implementation AddressDownViewXin
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    self.backgroundColor = kMainLightGrayColor;
    
    [self addSubview:self.addressLT];
    [self addSubview:self.houseNumberLT];
    [self addSubview:self.postCodeLT];
    
    self.viewArr = @[self.addressLT,self.houseNumberLT,self.postCodeLT];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    
    [self.viewArr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedSpacing:1 leadSpacing:1 tailSpacing:1];
    [self.viewArr mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
    }];
}


#pragma mark - 1-23新需求
- (void)xinDemand2019123 {

}


#pragma mark - getter
- (NewAddressLabelTextField *)addressLT {
    if (!_addressLT) {
        
        //2019-2-22 修改词条名字。同样的汉子显示不同的英文
        _addressLT = [[NewAddressLabelTextField alloc] initWithFrame:kAddressLTFrame title:NSLocalizedString(DetailAddress_xin_FullAddress, @"详细地址") placeHolder:NSLocalizedString(L_LouHaoMenPaiHaoEtc, @"楼号、门牌号等,例如:16号楼101室")];
                
        //2019-2-20 UITextFieldDelegate
        _addressLT.textField.delegate = self;
    }
    return _addressLT;
}

#pragma mark - 2019-2-20 UITextFieldDelegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    if (self.clickAddressTFBlock) {
        self.clickAddressTFBlock();
    }
    return NO;
}


- (NewAddressLabelTextField *)houseNumberLT {
    if (!_houseNumberLT) {
        NSString *qsrmphStr = NSLocalizedString(ToastPleaseInputHouseNumber, @"请输入门牌号");
        _houseNumberLT = [[NewAddressLabelTextField alloc] initWithFrame:kAddressLTFrame title:NSLocalizedString(L_MenPaiHaoMa, @"门牌号码") placeHolder:qsrmphStr];
    }
    return _houseNumberLT;
}

- (NewAddressLabelTextField *)postCodeLT {
    if (!_postCodeLT) {
        NSString *qsryzbmStr = NSLocalizedString(ToastPleaseInputZipCode, @"请输入邮政编码");
        
        _postCodeLT = [[NewAddressLabelTextField alloc] initWithFrame:kAddressLTFrame title:NSLocalizedString(L_ZipCode, @"邮政编码") placeHolder:qsryzbmStr];
    }
    
    
    return _postCodeLT;
}

@end
